<?xml version="1.0" encoding="utf-8"?><!-- -*- mode: nxml; indent-tabs-mode: nil -*- -->
<xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:bz="http://www.bugzilla.org/rdf#">
  <xsl:param name="htmlUrl" select="rdf:RDF/bz:result/@rdf:about" />

  <xsl:template match="/">
    <xsl:choose>
      <xsl:when test="count(rdf:RDF/bz:result/bz:bugs/rdf:Seq/rdf:li) > 0">
        <xsl:apply-templates />
      </xsl:when>
      <xsl:otherwise>
        <p>Zarro boogs <a href="{$htmlUrl}">found</a></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="rdf:RDF/bz:result">
    <p>The following bugs <a href="{$htmlUrl}">seem relevant</a> to this problem:</p>
    <table>
      <thead>
        <tr>
          <th>bug #</th>
          <th>summary</th>
          <th>state</th>
          <th>assignee</th>
        </tr>
      </thead>
      <tbody>
        <xsl:apply-templates />
      </tbody>
    </table>
  </xsl:template>

  <xsl:template match="bz:bugs/rdf:Seq/rdf:li/bz:bug">
        <tr>
          <td><a href="{@rdf:about}"><xsl:value-of select="bz:id" /></a></td>
          <td><xsl:value-of select="bz:short_desc" /></td>
          <td>
            <xsl:choose>
              <xsl:when test="string-length(bz:resolution)=0">
                <xsl:value-of select="bz:bug_status" />
              </xsl:when>
              <xsl:when test="string-length(bz:resolution)>0">
                <xsl:value-of select="bz:resolution" />
              </xsl:when>
            </xsl:choose>
          </td>
          <td><xsl:value-of select="bz:assigned_to" /></td>
        </tr>
  </xsl:template>

  <xsl:template match="text()|@*" />
</xsl:stylesheet>
